<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <%--<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">--%>
    <meta name="viewport" content="width=device-width, initial-scale=0.3, user-scalable=0, minimum-scale=0, maximum-scale=5.0,user-scalable=yes">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" type="text/css" href="/css/street/street.css"/>
    <link rel="stylesheet" href="/css/officialDocument/officialDocument.css">
    <link rel="stylesheet" href="/lib/pagination/style/pagination.css">
    <link rel="stylesheet" href="/lib/laydate/need/laydate.css">
    <link rel="stylesheet" href="/css/base.css">
    <script src="/lib/jQuery-File-Upload-master/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.ui.widget.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.iframe-transport.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.fileupload.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/layer/layer.js?20201106" type="text/javascript" charset="utf-8"></script>
    <script src="/js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/base/tablePage.js"></script>
    <script src="/lib/laydate/laydate.js"></script>
    <script src="/lib/jquery.form.min.js"></script>
    <title>企业查询</title>
    <style>
        .M-box .active, .M-box1 .active, .M-box2 .active, .M-box3 .active {
            background: #2b7fe0!important;
            border: 1px solid #2b7fe0!important;
            margin: 0 3px!important;
            width: 29px!important;
            height: 29px!important;
            line-height: 29px!important;
            font-size: 12px!important;
        }
        .jump-ipt {
            margin: 0 3px;
            width: 28px;
            height: 26px;
            line-height: 26px;
            font-size: 12px;
        }
        .M-box a, .M-box1 a, .M-box2 a, .M-box3 a {
            margin: 0 3px!important;
            width: 29px!important;
            height: 29px!important;
            line-height: 29px!important;
            font-size: 12px!important;
        }
        td a{
            margin-right: 10px;
        }
        table td{
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
        body{
            background-color: #f7f7f7;
        }
        .header{
            background-color: #f7f7f7;
        }
        .formHead{
            height: 40px;
        }
        .formHead span{
            line-height:40px;
        }
        .formbox{
            border: 1px solid #dedede;
            width: 900px;
            background-color: #fff;
            margin: 0 auto;
            border-radius: 2px;
            padding: 0 20px;
            padding-bottom: 10px;
        }
        .spans1{
            height: 20px;
            border-left: 7px solid #2b7ee0;
            margin-right: 5px;
            display: inline-block;
            position: absolute;
            top: 11px;
        }
        .span1title{
            height: 40px;
            display: inline-block;
            font-size: 18px;
            margin-left: 15px;
            font-weight: 600;
            color: #151515;
        }
        .secondtitle{
            height: 40px;
            line-height: 40px;
            margin-top: 15px;
            position: relative;
            z-index: 998;
        }
        .secondtitlespan{
            position: absolute;
            z-index: 99999;
            font-size: 16px;
            color: #2b7ee0;
            font-weight: 600;
            background-color: #fff;
        }
        .line{
            width: 100%;
            height: 20px;
            border-bottom: 1px dashed #ccc;
            position: relative;
            z-index: 900;
        }
        .formbox td{
            position: relative;
            height: 40px;
            line-height: 40px;
            font-size: 14px;
            color: #424242;
            font-weight: 600;
            padding: 5px 10px;
            text-align: right;
        }
        .longText{
            width: 100%;
            border: 1px solid #d6d6d6;
            background-color: #f7f7f7;
            -webkit-border-radius: 6px;
            -moz-border-radius:6px;
            border-radius:6px;
        }
        .selectbox{
            width: 100%;
            border: 1px solid #d6d6d6;
            background-color: #f7f7f7;
            -webkit-border-radius: 6px;
            -moz-border-radius:6px;
            border-radius:6px;
        }
        .dwbtn{
            position: absolute;
            width: 60px;
            height: 30px;
            background-color: #228cdc;
            color: #fff;
            right: 5px;
            border-radius: 3px;
            cursor: pointer;
        }
        .lastbtn{
            width: 100px;
            height: 30px;
            background-color: #228cdc;
            color: #fff;
            border-radius: 5px;
            cursor: pointer;
        }
        .img_box{
            font-weight: 500;
        }
        .spantextbox li{
            height: 30px;
            line-height: 30px;
        }
        .spantextbox li input{
            float: right;
            height: 20px;
            padding: 0;
            margin-top: 5px;
            text-indent: 5px;
            margin-right: 34px;
            width: 128px;
        }
        .header{
            top: 43px;
            border:none;
        }
        .head .headli3{
            width:100px;
        }
        .fffbg tbody tr input[type=text] {
            width: 70%;
            height: 30px;
            border: 1px solid #ccc;
            border-radius: 4px;
            padding-left: 10px;
        }
        .fffbg tbody tr input[type=text]{
            width: 70%;
            height:30px;
            border:1px solid #ccc;
            border-radius: 4px;
            padding-left: 10px;
        }
        .fffbg tbody tr select{
            width: 70%;
            height:30px;
            border:1px solid #ccc;
            border-radius: 4px;
            padding-left: 10px;
        }

        #btnsearch{
            top: -42px;
            right: 53px;
            padding: 5px 10px;
            background: red;
            color: #fff;
            border-radius: 6px;
            position: absolute;
        }
        .errrs{
            width:100px;
            height: 100px;
            background: red;
            display: inline-block;
        }
        input[type=button]{
            width: 70px;
            height: 28px;
            line-height: 26px;
            padding-left:5px;
            text-align: center;
            background-image: url(../img/center_q.png);
            background-repeat: no-repeat;
            color: #000;
            cursor: pointer;
            font-size: 14px;
            font-family: Microsoft yahei,Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif;
            float: none;
            border:none;
        }
        .chongzhi{
            width: 70px;
            height: 28px;
            line-height: 26px;
            padding-left:2px;
            text-align: center;
            background-image: url(../img/center_q.png);
            background-repeat: no-repeat;
            color: #000;
            cursor: pointer;
            font-size: 13px;
            font-family: Microsoft yahei,Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif;
            float: none;
            display: inline-block;
            border:none;
        }

        .daochu{
            width: 70px;
            height: 28px;
            line-height: 26px;
            padding-left:2px;
            text-align: center;
            background-image: url(../img/center_q.png);
            background-repeat: no-repeat;
            color: #000;
            cursor: pointer;
            font-size: 13px;
            font-family: Microsoft yahei,Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif;
            float: none;
            display: inline-block;
            border:none;
            margin-left: 35px;
        }
        textarea{
            outline: none;
            width: 70%;
            border-radius: 4px;
            padding:10px;
            height:60px;
        }
        .headTop{
            z-index: 999;
        }
    </style>
</head>
<body>
    <div class="headTop">
        <div class="headImg">
            <img src="/img/document/icon_documentQuery.png" alt="">
        </div>
        <div class="divTitle">
            企业查询
        </div>
        <div class="closebtn" style="display: none">
            <button class="lastbtn" style="margin-left: 30px;background-color: #95aabe;float: right;margin-top: 7px;margin-right: 30px;" id="closebtn" type="button" onclick="closebtns($(this))">返回</button>
        </div>
    </div>
    <div style="margin: 0 auto;width: 97%;">
        <div class="formData" style="display: block;">
            <form id="registerForm" action="/fixForm/selectUnionAllByname" style="margin-top: 60px" method="post">
                <input type="hidden" name="page" value="1">
                <input type="hidden" name="pageSize" value="10">
                <input type="hidden" name="useFlag" value="">
                <table class="fffbg">
                    <thead>
                    <tr>
                        <th width="15%" style="font-size: 16pt;">常用条件</th>
                        <th width="35%"></th>
                        <th width="15%"></th>
                        <th width="35%"></th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td width="15%">
                            生产经营单位名称：
                        </td>
                        <td width="35%" style="text-align: left">
                            <input type="text" placeholder="请输入生产经营单位名称" id="title" name="unitName">
                        </td>
                        <td width="15%">
                            组织机构代码：
                        </td>
                        <td width="35%">
                            <input type="text" placeholder="请输入组织机构代码" id="" name="orgName">
                        </td>
                    </tr>
                    <tr>
                        <td width="15%">
                            所属区域：
                        </td>
                        <td width="35%" style="text-align: left">
                            <input type="text" placeholder="请输入所属区域" name="area">                        </td>
                        <td width="15%">
                            企业状态：
                        </td>
                        <td width="35%" style="text-align: left">
                            <select name="codeType" id="ztlx">
                                <option value="">请选择</option>
                                <option value="01">合格达标</option>
                                <option value="02">一般隐患</option>
                                <option value="03">突出隐患</option>
                                <option value="04">重大隐患</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td width="15%">
                            企业性质：
                        </td>
                        <td width="35%" style="text-align: left">
                            <select name="number">
                                <option value="">请选择</option>
                                <option value="1">一般安全生产法人单位基础信息</option>
                                <option value="2">小规模安全生产法人单位基础信息</option>
                                <option value="3">大型安全生产个体工商户基础信息</option>
                                <option value="4">小型安全生产个体工商户基础信息</option>
                                <option value="5">在建工程项目基础信息</option>
                            </select>

                        </td>
                        <td width="15%">
                            注册时间：
                        </td>
                        <td width="35%" style="text-align: left">
                            <input type="text" class="longText" name="beginDate" readonly="readonly"  onclick="laydate({istime: true, format: 'YYYY-MM-DD'})">
                        </td>

                    </tr>
                    <tr>

                        <td width="15%">
                            营业状态：
                        </td>
                        <td width="35%" style="text-align: left">
                            <select name="businesSstuts" class="selectbox">
                                <option value="">请选择</option>
                                <option value="1">营业</option>
                                <option value="2">停业(歇业)</option>
                                <option value="3">关闭</option>
                            </select>
                        </td>
                        <td width="15%">
                            是否涉及危险化学品：
                        </td>
                        <td width="35%" style="text-align: left">
                            <select name="dangerous" class="selectbox"><option value="">请选择</option><option value="1">是</option><option value="2">否</option></select>
                        </td>

                    </tr>
                    <tr>

                        <td width="15%">
                            是否涉及有限空间作业：
                        </td>
                        <td width="35%" style="text-align: left">
                            <select name="operationsInvolvingFiniteSpaces" class="selectbox selectbox4"><option value="">请选择</option><option value="1">是</option><option value="2">否</option></select>                        </td>
                        <td width="15%">
                            是否涉及特种设备：
                        </td>
                        <td width="35%" style="text-align: left">
                            <select name="specialEquipment" class="selectbox selectbox4"><option value="">请选择</option><option value="1">是</option><option value="2">否</option></select>
                        </td>

                    </tr>

                    <tr>
                        <td colspan="4">
                            <input type="button" value="搜索" onclick="formsubmit($(this))">
                            <a href="javascript:void(0)" class="chongzhi" style="    margin-left: 50px;">重置</a>
                            <a href="javascript:void(0)" class="daochu">导出</a>
                        </td>

                    </tr>
                    </tbody>
                </table>
            </form>
        </div>


        <div class="tableData" style="display:none;position: relative;margin-top: 60px" id="pagediv">
            <table style="width: 100%">
                <thead>
                    <tr class="pagedivTh">
                        <th>序号</th>
                        <th>企业名称</th>
                        <th>企业性质</th>
                        <th>联系人</th>
                        <th>联系方式</th>
                        <th>企业状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody id="pageTbody">

                </tbody>
            </table>
            <div id="dbgz_page" class="M-box3" style="display: block;">

            </div>
    </div>
    <script>
        function formsubmit(e){
            var einfoName = $('input[name=unitName]').val();
            var einfoFix = $('select[name=enterpriseState] option:selected').val();
            var einfoDigest = $('input[name=legalRepresentative]').val();
            var einfoStuts = $('input[name=mobilePhone]').val();
            var einfoDelegatename = $('select[name=typesOfRegistration] option:selected').val();
            var einfoMark = $('input[name=enterpriseCoordinate]').val();
            var ajaxPage={
                data:{
                    page:1,//当前处于第几页
                    pageSize:10,//一页显示几条
                    useFlag:true,
                },
                page:function (num) {
                    var me=this;
                    $('[name="page"]').val(this.data.page)
                    $('[name="pageSize"]').val(this.data.pageSize)
                    $('[name="useFlag"]').val(this.data.useFlag)

                    $('#registerForm').ajaxSubmit({
                        dataType:'json',
                        success:function(json){
                            //window.history.back(-1);
                            var data = json.datas;
                            var str = '';
                            $('.closebtn').show();
                            $('.tableData').show();
                            $('.formData').hide();
                            for(var i=0;i<data.length;i++){
                                var j = i+1;
                                if(data[i].biaozhi == 1){
                                    var xz = '一般安全生产法人单位基础信息';
                                }else if(data[i].biaozhi == 2){
                                    var xz = '小规模安全生产法人单位基础信息';
                                }else if(data[i].biaozhi == 3){
                                    var xz = '大型安全生产个体工商户基础信息';
                                }else if(data[i].biaozhi == 4){
                                    var xz = '小型安全生产个体工商户基础信息';
                                }else if(data[i].biaozhi == 5){
                                    var xz = '在建工程项目基础信息';
                                }
                                str +=    '<tr>'+
                                    '<td>'+j+'</td>'+
                                    '<td>'+data[i].name+'</td>'+
                                    '<td>'+ xz +'</td>'+
                                    '<td>'+ data[i].username +'</td>'+
                                    '<td>'+ data[i].iphone +'</td>'+
                                    '<td>'+ data[i].codeName +'</td>'+
                                    '<td>'+
                                    '<a href="javascript:;" onclick="ckxq($(this))" type="'+ data[i].biaozhi +'" fixFromId="'+ data[i].zhujian +'">查看</a>'+
                                    '<a href="javascript:;" onclick="map($(this))"  type="'+ data[i].biaozhi +'" fixFromId="'+ data[i].zhujian +'">地图</a>'+
                                    '</td>'+
                                    '</tr>'
                            }
                            $('#pageTbody').html(str);
                            if(json.total > 10){
                                $('#dbgz_page').show();
                                me.pageTwo(json.total,me.data.pageSize,me.data.page)
                            }else{
                                $('#dbgz_page').hide();
                            }
                        }
                    })
                },
                pageTwo:function (totalData, pageSize,indexs) {
                    var mes=this;
                    $('#dbgz_page').pagination({
                        totalData: totalData,
                        showData: pageSize,
                        jump: true,
                        coping: true,
                        homePage:'',
                        endPage: '',
                        current:indexs||1,
                        callback: function (index) {

                            mes.data.page=index.getCurrent();
                            mes.page();
                        }
                    });
                }
            }
            ajaxPage.page();
        }
        function closebtns(e){
            $('.closebtn').hide();
            $('.tableData').hide();
            $('.formData').show();
        }
        function ckxq(e){
            var type = e.attr('type');
            var fixFromId = e.attr('fixFromId');
            window.location.href="stoneGardenFigure"+type+"?types=2&fixFromId="+fixFromId;
        }
        function map(e){
            var type = e.attr('type');
            var fixFromId = e.attr('fixFromId');
            window.open("/street/map?types=2&fixFromId="+fixFromId+'&type='+type);
        }

//        点击重置
        $('.chongzhi').click(function(){
            $('input[name=unitName]').val('');
            $('input[name=orgName]').val('');
            $('select[name=codeType]').find('option[value=""]').prop('selected',true);
            $('select[name=businesSstuts]').find('option[value=""]').prop('selected',true);
            $('select[name=dangerous]').find('option[value=""]').prop('selected',true);
            $('select[name=codeType]').find('option[value=""]').prop('selected',true);
            $('select[name=number]').find('option[value=""]').prop('selected',true);
            $('select[name=operationsInvolvingFiniteSpaces]').find('option[value=""]').prop('selected',true);

            $('select[name=specialEquipment]').find('option[value=""]').prop('selected',true);
            $('input[name=area]').val('');
            $('input[name=beginDate]').val('');
        })

        $(document).on('click','.daochu',function () {
            var unitName = $('input[name=unitName]').val();
            var orgName = $('input[name=orgName]').val();
            var codeType = $('select[name=codeType] option:selected').val();
            var area = $('input[name=area]').val();
            var number = $('select[name=number] option:selected').val();
            var beginDate = $('input[name=beginDate]').val();
            var businesSstuts = $('select[name=businesSstuts] option:selected').val();
            var dangerous = $('select[name=dangerous] option:selected').val();
            /*var enterpriseState = $('select[name=enterpriseState] option:selected').val();
            var legalRepresentative = $('input[name=legalRepresentative]').val();
            var mobilePhone = $('input[name=mobilePhone]').val();
            var typesOfRegistration = $('select[name=typesOfRegistration] option:selected').val();
            var enterpriseCoordinate = $('input[name=enterpriseCoordinate]').val();*/

            window.location.href='<%=basePath%>/fixForm/selectUnionAllByname?unitName='+unitName+'&orgName='+orgName+
                '&codeType='+codeType+'&area='+area+'&number='+number+
                '&beginDate='+beginDate+'&businesSstuts='+businesSstuts+'&dangerous='+dangerous+'&daochu=1';

            /*$('#registerForm').ajaxSubmit({
                dataType: 'json',
                data: {daochu:1},
                processData: false,
                contentType: false,
                success: function () {

                }
            })*/
            })

        function ajaxShow(){

        }


    </script>
</body>
</html>